Fix session object handling