make sure the thread doesn't block