ensure insertBefore is passed null not undefined