Fixed a bug introduced in the previous commit. It only happens in Moodle 2.6
Merge remote-tracking branch 'upstream/master'