Add limit to automatic restarts