[cvs-nhc98] Merge more hat-tool fixes into stable-1-06-branch.