updated to use os.environ.get to stop KeyError