Fix bugs to addState.

Now we can set a parent, and function postLoad with jquery.