Fix some nullpointerexceptions