fixed bug in the app that would prevent beforeOutput in middlewaredispatcher from working, also added twig as a possible tempplate loader
added twig to advanced apptemplate