Update main.js

totalRecords was no resetting