Fix term string compare bug