implemented longest_only parameter
fixed NCBO-569
fixed NCBO-569