Correctly detect the environment