improved ncurses detection