Fix custom-element instantiation bugs