Fixed issues with buffer usage.