Various bugfixes

Fixes for: 
#3482
#2469
#3928
#3863
#3769
Check code here