Fix corruption of dat files

Fix 2 issues which can cause data corruption. This only affects the file-based filter farm.