fixed Term#compareTo to conform to its general contract
Merge pull request #1074 from yilongli/fixing-issue-1073

fixed Term#compareTo to conform to its general contract