PR for issue #17

Fixes issue #17 (if an issue), only tested for TokenAuthentication.