Added more db stuff / Fixed a npe bug for portals map