Fixed errors in deprecatedlib.php
Check that the function exists rather than relying on the Moodle version