Fixed unittests and added sync