fixing the logic for the haystack