fixed handling of fputc