add the setBufferWithRange method