add terminate macro