fix buffer allocation size