Update buffer.c

fix bug...