Check only the session_id() result to determine if a session is active, as suggested by benhuson in #552