add process exit when encounter error