threads not resetting correctly