Make sync var local instead of global