Repaired sorting of layertree nodes