Fix equals(), hashCode() and compareTo() tests