Fix potential null pointer