Fixed bad index selection