fix keys handling to include values from all children, not just last child