problem with the sorting; check why the loop do in random