[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