handle malformed paths better

PR for weird cases described in #1352.

I preserved try..catch in place for performance reasons since node.js core seem to be doing [the same thing](https://github.com/joyent/node/blob/master/lib/querystring.js#L192), see [discussion](https://github.com/joyent/node/pull/2248).