Fixed a strange condition where session would exist but session_key would be None