fixed index not found condition