fix potential nullref