Also removed some unnecessary checks for session->listener: The Session constructor takes the listener as an argument.