After changing the grid layout for a vertical layout which is better for the purpose I had anyway, I was still having the same problem. The issue was that instantiating at runtime sometimes changes the scale. Simply adding the line:
temp.transform.localscale = new vector3 (1, 1, 1)
solved the problem for me. Thanks to Declan for pointing this out to me.
Mike