Minor changes to environment detection