Fixed CreateObject error and undefined error