fix environment settings
Bug fixes