Fix issue when copying nodes with custom attributes