Fixed calculation of numpgs in insertrec