fix caching and refactor pref manager so i can throw on unexpected nulls