fix code (add check of date, but not work)