small improvements on error logging