handle return parameters correctly in optimizing()

`optimizing()` currently doesn't work for multidimensional parameters.

This uses the generic helper to fix it. One mildly unpleasant side-effect is that scalar parameters then become arrays of shape `(1,)`. I'll leave it up to you if there's a nice way to deal with that in `_par_vector2dict`.