Fix bug that prevented inverting the empty alg.