fixed a bug that caused last record not to show