fixed error handling

errors were resolving to undefined when written to log files due
referencing
update in version