fix a silly bug in child sorting