add sync to avoid abnormal quit