move io platform-dependent code