Fixed a bug with state saver