Bug fix about the TER calculation