Further fixes to tests (remaining issue: they are still non-deterministic and fail sometimes)