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.