Added checking for metadata type