Fixed remaining segfault errors