patches 6841 & 6842 (look for ug headers in include/ and include/ug/, to support new versions of ug) merged from the trunk