environment: write new keys in consistent order
Merge pull request #202 from jonboulle/env

environment: write new keys in consistent order