fix term selection

change parameter
handle some unacceptable states