Minor bugfixes to window manager code - still needs TLC... boo hacking :(