fixing a KeyError bug in the auto-scaling code