Fix deprecated function calls for Moodle 2.6