Fix other crash in hessian of stack()

@goodfeli, can you check if the change to `hessian()` makes sense to you?
I feel like if an input is connected to the cost, but the gradient is constant, then the hessian should actually be a matrix of zeros, not a disconnected error. Do you agree?