Fixed issue with window resizing

Hopefully anyway, no more infinite loops and it is actually getting the
correct process. I guess the program was running too fast or something?