Fixed a bug in the calculation of the number of results.