fix error with not processing last row