updated script, add session manager login, fix bugs