improving error logging