imex: Fix two segfaults.

Signed-off-by: Matthew Emmett <memmett@gmail.com>