Fixed seg fault bug, now there's another bug