Fixed restart bugs