Fixes #854 Fixes #884 Fixes #951 Fixes #954 (cherry picked from commit a8b6f70be1860aa502795f0dd30299c87d54dbbe)