use more generic detection of session