handle possible null pointer