Fixed segfaults when switching syntax highlighting.