added debugging output for medianfilter
merged with origin
quick fix for medianfilter