Fix for visits sql with date filters.
Merge remote-tracking branch 'origin/hotfix'