Exit only from the thread (bugfix)