fix potential data loss issue on failed umount (patch from #942)