Improvements to Hg support