Fix some more possible null pointer dereferences