Fix for environment variable KeyError