Thread wait&sync fixed