Fix thread safety parallel install

Fixes #2607