BUG FIX: cartesian_product now converts all arguments to ndarrays

Fixes #6439.