Merge "Fix buffer allocation"