Fix various compiler warnings (bug #322)