CW-331 Some bug bounty hunting. Fixed state saving