fixed bug with maxStates and current index