Fix more gcc build breaks. One of these was a subtle bug in the code that was caught...