Make tests work for now

No longer invalid memory accesses. Super ugly code in main.c now, though.