improve sync()