Fixes for #2077, #2056, #2054, #2088, #2038, #2050, #2081

Fixes for #2077, #2056, #2054, #2088, #2038, #2050, #2081