added proper login/db/session restore