Hide Object in Hierarchy Window

I'm trying to make an object container which holds several game objects which aren't shown in the hierarchy window, but I can't seem to get the hideFlags property to work. Here's the script I currently have:

class ObjectContainerEditor extends Editor {
    function OnInspectorGUI() {
    	if (GUILayout.Button("Create Object"))
    		CreateObject();
    }

    function CreateObject() {
    	var newObj : GameObject = new GameObject();
    	newObj.transform.parent = target.transform;

    	newObj.hideFlags = HideFlags.HideInHierarchy;
    }
}

It adds a new GameObject to the target object like it's supposed to, but the new object is still shown in the hierarchy window. What am I doing wrong?

On a quick look, this seems like a bug. Could you be so kind to file it (Unity->Menu->Report a problem) ?

I also found this problem, is bug?

Maybe you can try EditorUtility.CreateGameObjectWithHideFlags.