Fix buffer wrong release of buffer