Trying to resolve segfault