Maybe checking vm state before saving will avoid many potential problems.