added environment check