WIP: Fix a crash.

Patch from Gunnar.