Update index.php

Changed code flow to fulfill define dependency