Fixed KeyError in values dictionary