trying to fix segfault from hash function