fix state manipulation