Fixing a bug when calling the session object