fixed a few bugs in the metadata generation script, #16