Fixing errors after moving to hibernate