fixing bug in family function