Several minor bug fixes

- bugs 5239 and 5242
- bug 5260
- bug 5287
- bug 5283
- bug 5311

Do not forget to check out PR on Core...