Writing, compiles and does something, but reading segfaults, investigate