fix rounding problem, add param for lineperpage