the try catch behaviour in the  control flow erroneously resets the session to null