Fix bugs in injection of preferences and resources. Tests can now use annotation database system
All test now run with annotation database on.