Check if otu.metadata_hash.keys not nil before calling each

Fixes 192