speed optimization of select0.
optimize select0 and next0.
fix bug.
speed improvement.
beutify codes.