Patch for moodle 2.2