add counter correction to keep server and client in sync