handle both response types