Fix crash when style changed