Fixed out of bounds handling.