sync some code to simplify testing