bug fixes to make work with db-pagination