Attempting to work around issues by adding backwards-compatible serializeState and deserializeState.