added sorting before syncing. it is important for creation an deletion of folders