Added samples

Three new samples and some additional code fixes for bugs found via
these samples.