No segfault. Still a problem when it writes to file