fixed the restart function