Fixed the thread inside a thread issue