handle error pointers properly

there were some issues in how
error types were handled.

this should fix that