Added separate logging of errors.