Hi,
Yes, Pedram is correct. Head should not be used to extract the CTensor[...] object without first checking/imposing a definite order of indices. The xCoba command ToCCanonical will sort indices in CTensor[...][indices] as ToCanonical would do it in tensor[indices], so a possible solution is to replace
riem = Head[...]
by
riem = Head[ToCCanonical[...]]
and then the rest of the computation will work as expected.
In general, it is better to work with indices, because then any index order will be fine, and equations look clearer. In your case, replace the definition of riem above by
riem[a_, b_, c_, d_] := \[ScriptG][a, d] \[ScriptG][b, c] - \[ScriptG][a, c] \[ScriptG][b, d]
and then the rest of the computation will work as expected too.
Finally, check the consistency between the specified metric signature list and the signs of the metric components. xCoba will not always catch that type of problem, and results might be wrong.
Cheers,
Jose.