Fix two off-by-one errors.

@dayflower asked me to send these patches.

In fact I don't remember what they were for very well...