fixed buf_getc()