added check for environment variables