fixed some statemanagement stuff