Fix various build issues