Several build fixes