Bugfix in nanmean2 and nanmedian2

Fixed an error if dim wasn't passed