Fixing thread state values. WaitTest now terminates.

That wasn't so bad.