Fix buffer usage