Bug fix in put_child