fix to check changed data flag on write down data to file