Bugfixes for buffer class