sync is working
adjusted the writing of files to response