Fixed a major segfault