fix null pointers