License under MIT License.
Fix some small issues with recursion depth and environment pointers.