Fixed segfault finally.