fixed indices bug