Restore original function state after instantiation.

Instead of clearing the local variables, we restore the original ones.