Workaround dclone() not being thread-safe