Fix bug with hibernate