applying fixes from hg version