Fix bug when using StateToContent to process the same state twice. The same reference would not be returned. Now it is