Fixed printing segfault bug.