Fixed test naming.
Fixed nondeterminism bug and provided tests to make sure.