Fixed bug with modinfo corruption (Fix for https://tracker.moodle.org/browse/MDL-36789)