fix the tuple index bug