rewrite IO module (non-blocking now)