fixed pagination and next prev buttons issues

dedicated to Wally fellows