Print stack trace on error

Fixes ULTRA arithmetic errors. Also, prints stack traces to both stdout and stderr when an agent has an exception.