changed the error logging to use a single function, improved tracebacks