fix a potential null pointer