Make median behave on arrays as mean and var

Right now `median` doesn't work on arrays with more than one dimension.