Clone preference values to our storage instead of direct assignment.

This fixes the issue reported in #7130.