Added support for size in getBuffer() function