Fixup qsort problem, add LPC switch tests.

Fix #66