Fixed bug where last result > total results