Add some fixes for setting env value