fix bug when some distinct values are NoneType