Fix bug handling error in snapshot loop

    - Also added date_to_str