fixed handling of cli errors.