fix for metadata = to length crashing as well