Fix a bug in setting environment

We were overwriting instead of appending