fixing issue with lastSyncedPage calculation for overflows
fixing tests