How do you know that lastSibling is set?   ISTM it could be undefined.