Adding more exception checking.

Signed-off-by: Joe Buck <jbbuck@gmail.com>