fix multiple errors data race