Fix sorting on custom properties

Depth wasn't taken into account, so subsections could get promoted
up a level if they had an sort order property equal to a parent.