index bound check fixed from previous patch