refresh session logic