fix the nnCostFunction