still segfaulting...not sure why