Fix up caching in typecode_ndarray