replace deprecated functions for Moodle 2.6