fixing #3127

please see commit message 80207cc6993b1cd1dc94d67c88278054167cfb04 for additional details

Fixes #3127 
Fixes #3305 
Fixes #3326  
Fixes #3162