avoid crashes on null pointers