bad logic fix in TryGetElement