fix some bug and complete window construct in windows, testing previous commit.