applied apm's patch proposal, getting rid of XDrawLines