fix rlwrap detection logic