Fixed Login and logout bugs.