Fix some small issues with recursion depth and environment pointers.