Fix racing condition in require