Fix perf issues from cloning state