Fixed equals and hashCode methods to be consistent with java (equals and hashCode) requirements.