fix refactor to work with sync