Start writing ipc unit tests
Fix a lot of bad pointers and missing nulls