Fixed an error in topState resulting in the wrong state being returned
Fixed an error in topState which used to return the penultimate state…
… instead of the last state on the stack.
In this implementation, the last element in the stack is the current state and the second to last element is the top state. Check out the flex documentation about top state and pop state.