Fixed bug with environment check