Added check for environment variables.