Fix bug in restart mode