fixed depth bug