Add a counter for failures, to prevent infinite loops if the camera is broken