minor fixes to the compute depth function