State saving now works