fix bug in checkMetadata