bug fixes, improved pagination