fixed endless loop when middleware throws
0.1.3