bug fix for insertbefore option