fix NPE after entityManager.clear()