fixed bug on putc() when resetting a _IOFBF buffer