Fix threading/esc key support