Fix gradient of split when there are disconnected outputs

This should fix gh-1589