Fixed #5147 collapsingbug in einsum

At tests is also included that fails without the fix.