Fixed issue with maxDepth