Fixes a bug in the query date