now logging errors properly