avoid sample bug when x is len 1