Working travis setup

Based on top of #23.

Getting this to work on travis was not easy. See the commit comments for more details on the various workarounds.