fixed problem with prev/next, add check for undefined in pageCount()