make static hash table access thread-safe in foreign.c