Fixed putc method