func (cl *Client) AddTorrentSpec(spec *TorrentSpec) (t *Torrent, new bool, err error) {
        t, new = cl.AddTorrentInfoHashWithStorage(spec.InfoHash, spec.Storage)
        err = t.MergeSpec(spec)
+       if err != nil && new {
+               t.Drop()
+       }
        return
 }
 
 
 import (
        "expvar"
        "fmt"
+       stdLog "log"
        "net"
        "net/http"
        "os"
 }
 
 func mainErr() error {
+       stdLog.SetFlags(stdLog.Flags() | stdLog.Lshortfile)
        var flags struct {
                tagflag.StartPos
                Command string
        http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
                client.WriteStatus(w)
        })
-       addTorrents(client)
+       err = addTorrents(client)
+       if err != nil {
+               return fmt.Errorf("adding torrents: %w", err)
+       }
        defer outputStats(client)
        if client.WaitAll() {
                log.Print("downloaded ALL the torrents")
 
        for i, fileInfo := range upvertedFiles {
                s, err := ToSafeFilePath(append([]string{info.Name}, fileInfo.Path...)...)
                if err != nil {
-                       return nil, fmt.Errorf("file %v has unsafe path %q", i, fileInfo.Path)
+                       return nil, fmt.Errorf("file %v has unsafe path %q: %w", i, fileInfo.Path, err)
                }
                f := file{
                        path:   filepath.Join(dir, s),
 
 
 import (
        "errors"
-       "log"
        "path/filepath"
        "strings"
 )
        }
        safeFilePath := filepath.Join(safeComps...)
        fc := firstComponent(safeFilePath)
-       log.Printf("%q", fc)
        switch fc {
        case "..":
                return "", errors.New("escapes root dir")