Fixing bug with search by date