fixed bug skipping 1 record