Added conditional restart after upgrade