fixed problem when both parents are not nil