Fix distcheck, and try to prevent future breakages