added test for Middleware/prepare_app problem, but the test does not reproduce the bug...