fix(preferences): improve the code