Small updates

Corrected to not output empty file. Case check on metadata type.