Fix problems in file persistence

Signed-off-by: José Guilherme Vanz < guilherme.sft@gmail.com >