Contrib 4754 m23

Fix through upgrade for https://tracker.moodle.org/browse/CONTRIB-4754