Bug fix

Previously the program was failing to save new metadata, and also
looping through a maximum of 10 items. These are fixed.