Amazon's revenue beats expectations, despite $2 billion loss