Trying to correct a segfault