There was a copy of that file already in my templates/macro directory, so I modified that as you described, tested it on a made-up sample test, and grading now works perfectly.
I also checked that it still works in homework mode.
Fantastic bit of diagnosis!!!
Thanks again.