fixed signal handling, now working as expected (even when window has no focus)