* Improve app middleware load logic.