Fix potential race condition between autoRefresh and elementName