Fix issue #233. Fix possible out-of-bounds read.