Fixed environment modification with overwrite