fixed buffer problems