fixes layer sorting regression introduced in f03045d