improved error-handling and hopefully fixing hibernate-error