fix for #77 Catch TypeError in addition to ValueError in the case of an invalid string.

Different implementations seem to throw the other one. This is reproducably failing on Travis, but not locally.