Fixed a bug where we got segfault