It is another code order thing. Move lines 39-165 up above line 7. That should correct that error.
The include virtual() instead of require_once() is controlled by your site definition. Change your site settings to use "document relative" instead of "site relative" links and it should start using require_once automatically.