Fixed bug: Check for pre-calculated value returned without clearing
the call_stack, giving false-positives for recursion. Fixed by moving
this check ahead of insertion to call_stack.