better errors when log.debug is enabled