fixed global root & window variable