Retrieved the correct output directly, not via an order by

This fix will solve the issue with the test which is breaking master. The order_by('output') was not enough to guarantee the correct ordering: the order of the hazard output is unspecified, the first output could be associated to branch b1 and the second to branch b2 on a machine, but they can be switched on another machine.