Prevent null reference access when unsetting styles