Fix various null pointer exceptions in new input/output implementations.