add keep session function