Fixed the logic for resuming interrupted runs