minor changes on stopping threads