bug fix in env code