Fixed some bugs in node creation