fix pagination, bug fixes