fixed stack and thread_wait