fix bad index