Fixed minor error when no parentNode