implement I/O dispatching