change hasattr check for metadata to a try/except.