Fix sendError calls to receive the full Error instance
Do not try to replace template variables in undefined elements

See #133