Fixed some JPA issues