Fix some bugs in the watcher when files were added and removed.