fix an index problem in the gui