fixed horrible segfault