Fix state inconsistency in StateInfo

Read stage state first when creating StageInfo
Change StateMachine to be based on equality not identity
Change StateMachine to not allow nulls
Deep copy TaskInfo outputs in constructor to avoid ConcurrentModificationException