terminate the process if anything goes wrong