fix term ordering