fix a bug and avoid problem caused by paging