fix https://tracker.moodle.org/browse/MDLSITE-2806