Fix for correctly store the submasks and their metainfo