Lock profile sync using a variable as a flag