fix bug in flattened_children_by_association