race condition when stopping