fix bugs with depth