Bug found and solved. FileNum incremented before its name was saved,
this way it could make errors