Improve logging in some unusual failure cases.