better buffer dump function