fix error when frontmost window is minimized

(fixes #5)