Fix potential nullref