SessionFactoryManager creation and some minor bugfixes