fix window open function bug and the test