Finish middleware usage tests, fixed issue with error handling middleware