Some fixes on hash code generating algorithm