Fixed bug in addStates