Fixed a bug introduced in the previous commit. It only happens in Moodle 2.6