to fix b) move the whole ```.then(function () { refresh(); })``` thing to line 887 so it's like
```
Main.gitControl.gitClone(remoteGitUrl, ".").then(function () { 
    refresh(); 
})
```