Fix incorrect exception wrapping