fixed depth sort bug