fixed code to work with latest oandajs