update the sync function so that profile documents are properly distributed