Fix faulty dom:attach / dom:detach behavior