ofThread, change order of flags and detach to avoid potential problems