Several compilation fixes