Fixing median of stream solution