Miscellaneous fixes about building