corrected error in median script