add synchronization and small error fixes