fixing scoping issue for index sync