Fixed bug when saving the list into a file