Fix for missing currentPage variable