Fixed a couple of nullpointers