Coverity fixes

A couple of small bounds checks that coverity suggested.