Fix a NPE.

It's a bit of a nasty little hack.