Implemented safe file saving.
Removed a stupid assert.