save preferences reference before doing anything else