refactored a couple of the log.error calls to probably log stack trace