Fix hashcode, add unit test