I think this cast can be done each time without checking `is_array`