Add debugger check
Add Ti clean-up call before exit