check session function