fixed buffer issues