Fix IndexOutOfBoundsException when sideBufferSize is larger than 1.
Issue #54