window add leader added, and fixed some bugs