reimplemented terminate