Fixed bug in median filter.