Don't crash on unparseable inputs.

This bug was introduced in PR #142 and mentioned again in #144.

Added test and fixed a minor style error as well to keep
'npm test' running smoothly.
Merge pull request #145 from STRML/fix144

Don't crash on improperly formatted inputs. Introduced in #131 and fixes #144.