Optimize story grading
Fix non-null constraint error