fixed an error in depth updating (defaulted to NULL, not current depth)