Fix a bug in grade validator.