fixing bug with dateTo