Fix buffer resize