fixed a bug in the depth computation, but the depth calculated now is still not correct