Update lib.php to work in Moodle 2.6-2.8dev