fix flaws when using different versions of hibernate