Man charged with killing foster son takes stand