fixed bugs when calculating remaining grade stuff