Fix initialization timing of defaultApiEndpoint