Improve the error handling in case of wrong environment