Fix offscreen cursor bug