fixed bug in compareTo()