improve persistence layer
fix bugs