fixed high cpu usage where output and input were continuously polling.