Fixed some bugs for sequence resize.
Avoid signed/unsigned comparison warning.