fixed index-related bug