calcgrade bug-fix and improvements