further tweaks to repl detection logic