fixed index errors