multiple corrections:

fix memleaks if premature stop (path stack not systematicaly freed)
fix typo on error message
fix segfault on wrong index in RESTOREDC records
add a flag "Error" in states
checking this flag and stopping if a record throw an error