Fixed last record problem