fixed bug in checking environment