fix possible segfault in hashmap