solved a bug in the statemanager in which the old state would not be removed.