Safe mode bug fix
Merge branch 'master' into MOODLE_25_STABLE