fix off-by-one bug in paginator