fixed file syncing with conditions