Fixed JPA issues