Fixed segfaults; testing now