squashed bug with date query parameters caused by variable scoping/foreach loop repetition