Tryget fixes

Fixing some suspect TryGetValue/lock usages