improve some error logging