Bug 814581 - Part 6/N: fix test cases.
Bug 814581 - Part 7/N: fix debug messages as well.