Fixed a bug in grading