Fix a bug where inputs would be started twice.
Fix a race condition in which inputs would not properly be stopped.