Fixes bug where file is not saved.