Fix segfault in main read loop

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>