Fix domain related leaks of debug information

Code contributed under MIT/X11 license.