Various bugfixes

Fixes for: 
#3482
#2469
#3928
#3863
#3769
So how does this fix it? Also please in the future break up these big PRs, it would mean I could merge the other bug fixes and leave the ones to be discussed open.