MDL-47752 grading: fixed bugs with the modgrade element