trying to resolve mysterious segfault