Update error handling of session validation for issue #7