save state at runtime