Fix compatibility with Moodle 2.5 and below