Ah too bad, I will have to find I workaround then, because I really need the derivative of the loss with t1 present there.
The minus sign is because I wrote the loss as (t - output) instead of (output - t), the update of the weights will be w += lr * grad instead of w += -lr * grad later on.
But thank you anyway for the help.