Fix a bug in the watcher causing segfaults