Fixed segfault with some test code