Ouch. Good catch. Making a copy of the state is a good approach. I'll take a look...