Fix bug where sometimes the HEAD file was a race condition