os.environ test clean-up and reorder overwrite

fixes issue 197
add comment explaining why the code was reordered
Merge pull request #200 from markmcclain/env_fix

Env fix