fix "Completion function changed window" bug