befor discoverWindow