misc libc i/o fixes