Bugfix putenv
Improve tests