Fixing a bug with unordered results