Added mysql persistence and fixed a couple of small issues