A few bug fixes

Hi,
Thank you for this convenient gem.
I had to make a few fixes in order to be able to generate a valid metadata package so I'm submitting those back to you.