I had a little trouble with grade_object::instert() because after insert only id was updated, but the rest of properties was not synced with the actual data in database.
I guess other developers might have the same problem when using the grade objects, the idea is to use update_from_db() after insert. It was already done in grade_category once and would have to be done several times in gradelib.php. There should be no performance penalty because we often use the grade objects after insert() anyway.
Patch is nearly ready...