better handling of exceptions when session expired