fixed hg and better errors