Fix state save bugs with mono.