[#590][refactor] Fix for deadlock in WeakHashMap. Refactored all code that used a
WeakHashMap to fake a field.