bug fixed, forget to break loop before, new bug: should output 500 record, but just output 499