fixed last-row bug.