fixed totalpages (didnt get a double value from getcounter)