bugfix in TEP's on terminate