fixed 401 handling and made trailing slash optional.

Let me double check that