bug fixed in Buffer.cpp