fix number of records calculation