Travis CI configuration file improvements

We've improved our Travis CI config file based on one in this repo and encountered some issues here and there in the process.