Fixed preferences scope implementation.  Modified tests to detect previous bug.