Correctly calculated gradient (dJ) for logitstic.