Fix with tests for Bug 5675.