fix race condition in profiledir creation.