logging errors better