Prefab does not scale in scale with screen size mode in UI

In unity 2d UI I have switched the canvas scaler into scale with screen size mode.

For those components added into the canvas manually the scaler works well. But for those added by scripts, even from the same prefab, the scaler does not work.

The appearance of the script-added component depends on the resolution setup, and mostly looks differently to those added manually, like following:

[53031-屏幕快照-2015-08-29-上午13233.png|53031]

The first button is added manually and the rests are adde by scripts. I’ve set the button layout to be horizontally expanded so they should have fit the screen width but didn’t. Anyone have ideas this could be a bug or did I set anything wrong?

I have same issue until i set

go.transform.SetParent( parent.transform , false );

And now works fine

Thanks to @IgorSimovic’s answer I found out that

Instantiate(prefab, parentTransform); does the same as go.transform.SetParent(parent.transform, false);

and

Instantiate(prefab, parentTransform.position, parentTransform.rotation); is like go.transform.SetParent(parent.transform, true);.

So for me, I just had to switch to this instantiating method:
Instantiate(prefab, parentTransform);