more refactoring of metadata.c: check URIs in metadata explicitly