Fix error reporting using logging