FIXED: input garbled after detached thread output