tweaked error logging