fix header variable reference in terminate