Fix build without threads