Fix check for CLI in SessionHandler