adjust buffer size correctly.