fixed gensession script abstract logic.