Bug fix: since the input thread does not wait for the event object