Fixed bugs when addresses were null, fixed session bug