Fix up error logging