Couple of fixes I noticed while testing ApiTrace with these samples.

More details in the commits.