[3.8] Some fixes

- Fix #1382
- Fix #1377
- Fix #1366
- Fix #1374
- Fix #1342
- Fix #1341
- Fix #1327
- Fix #1326
- Fix #1340
- Fix #1323
- Fix #1322
- Fix #1383
- Fix #1375
- Fix #1385
- Fix #1387
- Fix #1386
- Fix #1389
- Fix #1336
- Fix #1395
- Fix #1396
- Fix #1398
- Fix #1380
- Fix #1390
- Fix #1391
- Fix #1392
- Fix #1393
- Fix #1394
- Fix #1403
- Fix #1402
- Fix #1405