fix various compiler warnings (bug #3938)