improve buffer allocation reliability