replaced substr(-1)

Related Issue.

https://github.com/defunctzombie/node-url/issues/6