Fixed error when restoring values