As described in the comment above this should be protected by a if session is being opened test.