preparation for metadata validation
added check for invalid metadata length