fix invalid depth count