improved insertBefore