fixed bug in current page detection