Fixed index errors