Add logging of errors.
Fix typo.