Fix various compilation problems