Fix array coercion failing on hashes

Use [].flatten.compact instead