Fix errors resulting from 'master' merge.

(Many of the fixes were stolen from Torlus' raspi branch, which had
already done the merge).