       """
 
     @getAccount accountCode, (err, account)->
-      if err or not res?.username
+      if err or not account?.username
         post 'accounts', xml, callback
       else
+        console.log 'does this ever happen?', xml, callback
         put "accounts/#{accountCode}", xml, callback
 
   @deleteAccount: (accountCode, callback)->

  subObj = (sub)->
    sub =
      plan        : sub.plan[0].plan_code[0]
      quantity    : sub.quantity[0]['_']
      uuid        : sub.uuid[0]
      currency    : sub.currency[0]
      status      : sub.state[0]
      datetime    : sub.activated_at[0]['_']
      expires     : sub.expires_at[0]['_']
      renew       : sub.current_period_ends_at[0]['_']
      amount      : sub.unit_amount_in_cents[0]['_']

    if s.pending_subscription
      sub.pending =
        plan      : sub.pending_subscription[0].plan[0].plan_code[0]
        quantity  : sub.pending_subscription[0].quantity[0]['_']

    return sub


    trans =
      uuid       : t.uuid[0]
      status     : t.status[0]
      amount     : parseInt t.amount_in_cents[0]._, 10
      tax        : parseInt t.tax_in_cents[0]._, 10
      currency   : t.currency[0]
      datetime   : t.created_at[0]._
      refundable : t.refundable[0]._
      source     : t.source[0]

    trans.invoice = t.invoice[0].$.href  if t.invoice

    if trans.status in ['success', 'void']
      billing          = t.details[0].account[0].billing_info[0]
