Some test cleanups #314

Pinging @gregwebs Can you review these changes to make sure they don't
break anything? It seems fine to me.

This appears to fix the segfault, but I have no idea why.