fixes in attach() and in svg output