Hash code fixes and improvements