terribly inefficient but working solution to cursor lag bug