Fixed yet another nullpointer bug