fix bug where middleware never continues to the next in the list