move sync object under #if because it is not used otherwise