Fixed some bad written state variables