fix middleware
Merge pull request #24 from dduugg/feature/fix-middleware

looks good