Fixed compatibility with Moodle 2.7