More small fixes to I/O stuff