add exception handling for missing metadata