Fixed bug in metadata generation