Fixed TryGetValue implementation