fixed some problem, and change logic of persisting entities with xml