Implement environment cloning for correct continuation.