Fix bug with the logic behind registering/removing write filters