Fixed annoying bug involving multiple windows