MDL-40097 completion: Make restoring grade criteria more robust