fixed small indexing bug