fixed  grade calculation bug