Fix undeterministic test for python3