Possible fix for https://github.com/ETHZLET/moodle-qtype_matrix/issues/19. Tested against merging with existing course, deleting over existing course, and restoring into a brand new course.