solving null pointers