fix cannot read/write file issue