fixed the problem that selects records other than we should check.