fix the way cookies are set, courtesy of @max107
Merge pull request #1 from brad/middleware_patch

fix the way cookies are set, courtesy of @max107