Fixed bug where window switches incorrectly from non-hack buffer. (Also ...

...fixed typo and removed dead code)