Fix env handling in windows
Fix build for osx
Fix build for linux
Fix some leaks
Merge pull request #20 from luvit/fix-windows-env

Fix env handling in windows