Fix bug detected in moodle 2.7.1