Fix delete last row issue when using pagination