Fixed performance issue due to the latest changes to the recursion depth logic.