Fixed writing save file, other minor changes