Fixed bugs in index.php