Fixed a bug in setBufferSize