fixed hash generation and equals() method