fixes to state manipulation