Fix non-deterministic test