Fix "reference to 'thread' is ambiguous"