Merge "Prevent NPE when cloning gradients Bug #10436856" into klp-dev