BUG Fix encoding/decoding of np.ndarray subclasses

Only ndarray objects should be special cased, not subclasses.

Reported by Ag Stephens.