made environment checking more explicit