fixed bug with restart