Fix hashmap crashes with games that load modules.

This should properly unload and reload the functions as necessary.
Merge pull request #5842 from unknownbrackets/hashmap

Fix hashmap crashes with games that load modules