fixes to env
merge with master
bugs