a fix for Moodle 2.5 and fixing problem with validation error logic