Fix restriction tracker tests, and fix bug revealed by them