Minimize the change of recurse_depth overflowing by only incrementing it
after making sure its value is within bounds