fixed some index issues