Fix up bugs in api-paste

Change-Id: Ifdac9b875a91805500d3378e9f4e05ab58a8e101