Fix date querying