Fix loops and an error when Mirobot is not connected