ref #2044 ref #2049 ref #2054 fixes #2045 fixes #2050 fixes #2055 (cherry picked from commit f6e99451)