Fixed bug when saving collections