Issue 2523 (DEBUG)

These are debugging patches designed to help determine what is happened for issue #2523.