some patches to make things build correctly