fix totalpages init