fixed races reported by helgrind