Fix crashing when setting web-preferences, closes #443.