More useful getTaskDepth() implementation.