double-write-lock bugfix