fix bug in buffer sizes