MainLoop: improve error handling am: fd59221459
am: 8fbb6736ff

Change-Id: Ic53f2ae5da4a5e5aa8a659abd4f223c72398064a