More robust LogAndCheck