Some IO bug fixes