fixed a small bug with thread reseting