Make a copy of the environment

Without making a copy, the environment will be tainted for subsequent
actions.