took fixes from https://github.com/ciaranj/node-oauth/pull/147 and https://github.com/ciaranj/node-oauth/pull/160