changed applications terminate code to call DBG_TERMINATE