Fixed some broken error handling and added test fixtures to get the travis build fixed.